﻿import QtQuick 2.0
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import ConfigElementType 1.0
import "qrc:/qmlComponents/ConfigManager"
import "qrc:/qmlComponents/AxisModulePos"
import "qrc:/qmlComponents/VisionViewer"
import "qrc:/qmlComponents/CustomizedUIElement/RowColumnSelectorView"
import "qrc:/qmlComponents/CustomizedUIElement"

Item{
    ColumnLayout{
        spacing: 30
        CheckBox{
            Layout.alignment: Qt.AlignLeft
            text: qsTr("Is_Dry_Run")
            implicitHeight: 30
            background: Rectangle{
                radius: 5
                gradient: Gradient{
                    GradientStop{
                        position: 0
                        color: "#101010"
                    }
                    GradientStop{
                        position: 1
                        color: "#909090"
                    }
                }
            }
            checked: aaConfig.isDryRun
            onClicked: {
                 aaConfig.setIsDryRun(checked)
            }
        }

        RowLayout{
            XYZModulePos{
                moduleName: "SUTXYZ"
                posName: "StandbyPos"
            }
            XYZModulePos{
                moduleName: "AaHeadTheta"
                posName: "StandbyPos"
                isUVW: true
            }
        }

        RowLayout{
            XYZModulePos{
                moduleName: "SUTXYZ"
                posName: "LoadMaterialPos"
            }

            XYZModulePos{
                moduleName: "SUTXYZ"
                posName: "AssemblyPos"
            }
        }

        RowLayout{
            XYZModulePos{
                moduleName: "SUTXYZ"
                posName: "ULPrGripPos"
            }

            XYZModulePos{
                moduleName: "SUTXYZ"
                posName: "GluePrPos"
            }
        }

        RowLayout{
            XYZModulePos{
                moduleName: "SUTXYZ"
                posName: "PickLensPos"
            }

            XYZModulePos{
                moduleName: "AaHeadTheta"
                posName: "PickLensPos"
                isUVW: true
            }
            ColumnLayout{
                ConfigRow{
                    configModel: aaConfig
                    configName: "gripLensDelay"

                    Component.onCompleted: {
                        autoInit()
                    }
                }

                Button{
                    text: qsTr("Pick_Lens")
                    onClicked: {
                        tem.runSingleCmd(aaHead, "pickLensManual")
                    }
                }
            }

        }

        RowLayout{
            XYZModulePos{
                moduleName: "SUTXYZ"
                posName: "MushroomPos"
            }

            XYZModulePos{
                moduleName: "AaHeadTheta"
                posName: "MushroomPos"
                isUVW: true
            }

            ColumnLayout{
                ConfigRow{
                    configModel: aaConfig
                    configName: "useXYOffset"

                    Component.onCompleted: {
                        autoInit()
                    }
                }

                ConfigRow{
                    configModel: aaConfig
                    configName: "useThetaOffset"

                    Component.onCompleted: {
                        autoInit()
                    }
                }

                Button{
                    text: qsTr("PrToBond")
                    onClicked: {
                        tem.runSingleCmd(aaHead, "prToBond")
                    }
                }
            }

        }
    }
}
